/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nominalitzacions.drivers;

import commonlib.domain.Corpus;
import commonlib.domain.ABPair;
import java.util.Scanner;
import nominalitzacions.persistance.VerbCorpusDataManager;
import java.io.*;
import java.util.Iterator;


/**
 *
 * @author opengeekv2
 */
public class VerbCorpusDataManagerDriver {



    public static void main(String args[] ) {
        System.out.println("Escriu el path del fitxer origen:");
        Scanner sc = new Scanner(System.in);
        VerbCorpusDataManager VCDM = null;
        try {
            VCDM = new VerbCorpusDataManager(sc.next() );
        }
        catch (IOException ioe) {
            System.out.println(ioe.getMessage() );
        }

        Corpus corp = null;
        
        try {

            corp = VCDM.readCorpus();

        }

       catch (FileNotFoundException fnfe) {
            System.out.print(fnfe.getMessage() );
       }

       catch (IOException ioe) {
            System.out.println(ioe.getMessage() );
       }
       Iterator it = corp.iterator();
       while (it.hasNext() ) {
           ABPair pair = (ABPair) it.next();
           System.out.println(pair.getAlpha() + " " + pair.getBeta() );
       }

       corp.AddPair("cantaire", "cantar");
       try {
        VCDM.writeCorpus(corp);
       }

       catch (IOException ioe) {
           System.out.println(ioe.getMessage() );
       }

    }

}
